from core import *

frame_count = 1


def detection_listener(_, result_num):
    global frame_count
    print(f"Frame: {frame_count}")
    print(f"Population: {result_num}")
    frame_count += 120


def enter(video_path, interval, port, frame_interval, use_npu=False):
    print("Welcome to Scenic Spot Population Detector Demonstration (CLI Version)")
    print(f" - Reminder: Set port {port} on the mobile client to view the population tendency.")
    print(f" - Stop Monitoring: Press CTRL+C to terminate the program.")
    print()

    set_inference_type("npu" if use_npu else "rvv")
    initialize()

    start_server_thread(port)
    start_detect_thread(video_path, detection_listener, interval, frame_interval)
